#include "bit_range.h"

#include <QtGlobal>


namespace BitWin
{


BitRange::BitRange():
    _begin(0), _end(0)
{}

BitRange::BitRange(unsigned a, unsigned b):
    _begin(qMin(a, b)), _end(a < b ? b : a + 1)
{}

unsigned BitRange::begin() const
{
    return _begin;
}

unsigned BitRange::end() const
{
    return _end;
}

unsigned BitRange::length() const
{
    return (_end - _begin);
}


} // BitWin namespace end
